#include <stdio.h>
#include <math.h>
// #define sum(x, y) (x + y)
#define dbl double
#define square(x) (x * x)

int sum(int, int);
void firstReport();
void secondReport();
void solutions(dbl, dbl, dbl);
int func(int, int);
void thirdReport();

int main() {
    firstReport();
    secondReport();
    thirdReport();
    return 0;
}

int sum(int x, int y) {
    return x + y;
}

void firstReport() {
    int x=10, y=20;
    printf("x = 10, y = 20, summary of x and y is:\t%d\n", sum(x, y));
}

void secondReport() {
    dbl a, b, c;
    printf("Enter the double-type <a> <b> <c>:\t");
    scanf("%lf %lf %lf", &a, &b, &c);
    getchar();
    solutions(a, b, c);
}

void solutions(dbl a, dbl b, dbl c) {
    if(a == 0.0) {
        printf("\'a\' cannot match to 0!");
    } else {
        dbl assoc = square(b) - 4.0 * a * c;
        if(assoc < 0.0)
            printf("This equlation do\'t have real-number solutions.");
        else {
            dbl result;
            if (assoc == 0.0) {
                result = ((-1 * b) - pow(assoc, 0.5)) / (2.0 * a);
                printf("The equlation just have one result:\t%lf", result);
            } else {
                result = ((-1 * b) - pow(assoc, 0.5)) / (2.0 * a);
                printf("The equlation have two results:\t");
                printf("%lf\t", result);
                result = ((-1 * b) + pow(assoc, 0.5)) / (2.0 * a);
                printf("%lf", result);
            }
        }
    }
    printf("\n");
}

int func(int a, int b) {
    static int m=0, i=2;
    i += m + 1;
    m = i + a + b;
    return (m);
}

void thirdReport() {
    int k = 4, m = 1, p1, p2;
	p1 = func(k, m); 
	p2 = func(k, m);
	printf("%d, %d\n", p1, p2);
}
